package com.book.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.book.config.BookRepository;
import com.book.pojo.Book;
import com.book.mapper.BookDao;
import com.book.service.BookService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.http.HttpHost;
import org.elasticsearch.action.index.IndexRequest;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.common.xcontent.XContentType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.io.IOException;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author fk
 * @since 2023-10-16 20:45:59
 */
@Service
public class BookServiceImpl implements BookService{

    @Autowired
    private BookDao bookDao;
    @Autowired
    private BookRepository bookRepository;

    @Override
    public Iterable<Book> searchByName(String name) {
            return bookRepository.findByName(name);
        }

    @Override
    public List<Book> getAll() {
        return bookDao.selectList(null);
    }
}

